tar -xf 常用工具包.tgz
cd /root/k8s/常用工具包
yum -y localinstall *.rpm

#配置时间同步
# 添加阿里时钟服务器
sed -i '6a server ntp1.aliyun.com iburst\nserver ntp2.aliyun.com iburst' /etc/chrony.conf

# 启动服务
systemctl start chronyd && systemctl enable chronyd

# 验证
chronyc sources -v  >> /dev/null

#先离线安装docker
tar -xf docker-rpm.tgz
cd /root/k8s/docker-rpm
yum -y localinstall *.rpm
#设置cgroup
cat > /etc/docker/daemon.json << EOF
{
  "exec-opts": ["native.cgroupdriver=systemd"],
}
EOF
systemctl daemon-reload && systemctl restart docker

#离线安装k8s
tar -xf k8s-v1.23.15-rpm.tgz
cd /root/k8s/k8s-v1.23.15-rpm
yum -y localinstall *.rpm
cd ..
导入镜像
tar -xf k8s-v1.23.15-images.tgz
cd /root/k8s/k8s-v1.23.15-images
#列出当前文件所有镜像名
for i in `ls`; do echo $i; done
#用docker load 批量导入k8s镜像
for i in `ls`; do docker load -i $i; done
#以上步骤master和worker都执行

echo "请到master上拿kubectl join内容"

systemctl enable --now kubelet